package mygang.singleton;

import java.util.HashSet;
import mygang.listener.SessionListener;
import mygang.model.BaseModel;
import mygang.model.UserWrapper;

/**
 *
 * @author Volodymyr Lavrynovych <volodya.lavrynovych@gmail.com>
 * date: 08/08/2012
 */
public class Statistic extends BaseModel {

    private static final Statistic INSTANCE = new Statistic();
    
    public HashSet<UserWrapper> users = new HashSet<UserWrapper>();
    
    private Statistic(){}
    
    public static Statistic getInstance(){
        return INSTANCE;
    }
    
    public int getAllUsersNumber(){
        return SessionListener.getActiveSessionNumber();
    }
    
    public int getOnlineUsersNumber(){
        return users.size();
    }
    
    public int getGuestsNumber(){
        return getAllUsersNumber() - getOnlineUsersNumber();
    }
}